﻿using System;
using System.Net;

namespace Heimdallr.Net
{
    /// <summary>
    /// Represents the controller of <see cref="HttpElement"/>.
    /// </summary>
    public class HttpElementController : ServiceElementController<HttpElement>
    {
        /// <summary>
        /// Initializes a new instance of this class.
        /// </summary>
        public HttpElementController()
            : this(Dns.GetHostName(), 80, false)
        {
        }

        /// <summary>
        /// Initializes a new instance of this class, using specified host name.
        /// </summary>
        /// <param name="host">Specified host name.</param>
        /// <exception cref="ArgumentNullException"><paramref name="host"/> is null.</exception>
        public HttpElementController(string host)
            : this(host, 80, false)
        {
        }

        /// <summary>
        /// Initializes a new instance of this class, using specified host name and port number.
        /// </summary>
        /// <param name="host">Specified host name.</param>
        /// <param name="portNumber">Specified port number.</param>
        /// <exception cref="ArgumentNullException"><paramref name="host"/> is null.</exception>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="portNumber"/> is less than -1 or greater than 65,535.</exception>
        public HttpElementController(string host, int portNumber)
            : this(host, portNumber, false)
        {
        }

        /// <summary>
        /// Initializes a new instance of this class, using specified host name and port number.
        /// </summary>
        /// <param name="host">Specified host name.</param>
        /// <param name="portNumber">Specified port number.</param>
        /// <param name="isHttps">Indecates using HTTPS or not.</param>
        /// <exception cref="ArgumentNullException"><paramref name="host"/> is null.</exception>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="portNumber"/> is less than -1 or greater than 65,535.</exception>
        public HttpElementController(string host, int portNumber, bool isHttps)
            : base(new HttpElement(host, portNumber, false))
        {
        }
    }
}
